package com.meals.system.common;

/**
 * Description:
 * Parm:
 * return:
 * Author: Chen
 * Date: 2021/12/14
 */
public enum PayTypeEnum {


    // 支付方式: 0：无 1：支付宝 2：微信支付
    DEFAULT(-1, "ERROR"),
    NOT_PAY(0, "无"),
    ALI_PAY(1, "支付宝"),
    WEIXIN_PAY(2, "微信支付");

    private int payType;

    private String name;

    PayTypeEnum(int payType, String name){
        this.payType = payType;
        this.name = name;
    }

    // 根据int 类型返回支付枚举类 PayTypeEnum
    public static PayTypeEnum getPayTypeEnumByType(int payType){
        for (PayTypeEnum payTypeEnum : PayTypeEnum.values()){
            if (payTypeEnum.getPayType() == payType){
                return payTypeEnum;
            }
        }
        return DEFAULT;
    }
    public int getPayType(){
        return payType;
    }
    public void setPayType(int payType){
        this.payType = payType;
    }
    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name = name;
    }
}
